package redisUtils

import (
	"context"
	"github.com/redis/go-redis/v9"
	"log"
)

func CreatCon(username, password, Addr string, db int64) *redis.Client {
	redisClient := redis.NewClient(&redis.Options{
		Username: username,
		Addr:     Addr,
		Password: password,
		DB:       db,
	})
	str, err := redisClient.Ping(context.Background()).Result()
	if err != nil {
		panic(err)
	}
	log.Println("redis:", str)
	return redisClient
}
